home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / edison.dir / 00635_Script_Journal Object -- < prev    next >
Text File  |  1997-05-26  |  12KB  |  315 lines

  1. --Journal Object
  2. --Instantiated as gJournalObj
  3.  
  4. global gInventorIndexNum
  5. global gBulbExpMgr, gWattBIYobj, gTel  --These may not be right for Edison 
  6.  
  7.  
  8. property pCurrentBIYobj, pBIYobjList, pAtBIY
  9. property pClickBoardSpriteNum, pClickBoardRect, pPICTsprite
  10. property pBaseJournalCastNum, pCheckBaseCastNum, pCheckSpriteNum
  11. property pPICTlist
  12. --WATT SPECIFIC PROPERTIES
  13. property pCondensorAxisLocHList, pCylinderAxisLocVList, pWattTopBox, pWattBottomBox
  14. --BELL SPECIFIC PROPERTIES
  15. property pBellLocVList, pBellLocHList, pBellTopBox, pBellMiddleBox, pBellBottomBox
  16. --EDISON SPECIFIC PROPERTIES
  17. property pEdisonLocHList, pEdisonLocVList, pEdisonBox
  18. --INSTANTIATION EXITFRAME SCRIPT  for development only:           --\
  19. -- set gTel = mInit(script "TelephoneParentScript")
  20. --  set gEdisonBIYobj = 0 --\
  21. --  set gWattBIYobj = 0 --\
  22. --  set gJournalObj = mInit(script "Journal Object")
  23. --  mActivate(gTel)                                                                      --\
  24. --------------------------------------------------------------------<<ò>>
  25. on mInit me
  26.   
  27.   set pBIYobjList = [gBulbExpMgr, gWattBIYobj, gTel]
  28.   set pBaseJournalCastNum = the number of cast "EXPDRY1.PIC"
  29.   set pCurrentBIYobj = 0
  30.   set pAtBIY = false
  31.   
  32.   -- sprite declarations
  33.   set pPICTsprite = 2
  34.   set pClickBoardSpriteNum = 19 -- a rect with mJournalClickEvent(gJournalObj) msDn script must be in sprite 20
  35.   --                                                    of each BIY.  It must be completely offStage
  36.   set pCheckSpriteNum = 20 --the check graphic (or placeHolder) must also be off stage in this channel
  37.   
  38.   set pClickBoardRect = rect(60, 80, 420, 440)
  39.   set pCheckBaseCastNum = the number of cast "EXPDRY6.PIC"
  40.   set pPICTlist = ["EXPDRY1.PIC", "EXPDRY3.PIC", "EXPDRY2.PIC"]
  41.   
  42.   --WATT SPECIFIC PROPERTIES
  43.   set pCondensorAxisLocHList = [302, 344, 386]
  44.   set pCylinderAxisLocVList = [213, 235, 258, 309, 332, 354]
  45.   set pWattTopBox = rect(277, 202, 406, 271)
  46.   set pWattBottomBox = rect(277, 298, 406, 367)
  47.   
  48.   --BELL SPECIFIC PROPERTIES
  49.   set pBellLocVList = [177,192,206,222,264,279,293,308,355,370,384,400]
  50.   set pBellLocHList = [302,328,354]
  51.   set pBellTopBox = rect(288, 167, 368, 230)
  52.   set pBellMiddleBox = rect(288, 254, 368, 316)
  53.   set pBellBottomBox = rect(288, 346, 368, 408)
  54.   
  55.   --EDISON SPECIFIC PROPERTIES
  56.   set pEdisonLocHList = [297, 321, 345, 370, 395]
  57.   set pEdisonLocVList = [203, 223, 244, 264, 285, 306, 328, 351]
  58.   set pEdisonBox = rect(283, 192, 405, 364)
  59.   
  60.   return me
  61.   
  62. end mInit
  63. --------------------------------------------------------------------<<ò>>
  64. on mActivate me
  65.   
  66.   if pAtBIY then
  67.     
  68.     if (gInventorIndexNum < 4) and (gInventorIndexNum > 0) then
  69.       
  70.       set pCurrentBIYobj = getAt(pBIYobjList, gInventorIndexNum)
  71.       --      put "pBIYobjList" && pBIYobjList
  72.       --      put "gInventorIndexNum" && gInventorIndexNum
  73.       --      put "pCurrentBIYobj:" && pCurrentBIYobj
  74.       mSwitchToJournal(pCurrentBIYobj)
  75.       
  76.       puppetSprite pPICTsprite, true
  77.       puppetSprite pClickBoardSpriteNum, true
  78.       puppetSprite pCheckSpriteNum, true
  79.       set the trails of sprite pCheckSpriteNum = true
  80.       set the rect of sprite pClickBoardSpriteNum = pClickBoardRect
  81.       set the castNum of sprite pPICTsprite = the number of cast getAt(pPICTlist, gInventorIndexNum)
  82.       updateStage
  83.       
  84.       if gInventorIndexNum = 1 then
  85.         mDrawEdisonChecks(me)
  86.       else if gInventorIndexNum = 2 then
  87.         mDrawWattChecks(me)
  88.       else if gInventorIndexNum = 3 then
  89.         mDrawBellChecks(me)
  90.       end if
  91.       
  92.     else
  93.       alert "gInventorIndexNum is out of range"  --\ development only
  94.     end if
  95.     
  96.   end if
  97.   
  98. end mActivate
  99. --------------------------------------------------------------------<<ò>>
  100. on mClose me
  101.   
  102.   puppetSprite pPICTsprite, false
  103.   puppetSprite pClickBoardSpriteNum, false
  104.   puppetSprite pCheckSpriteNum, false
  105.   set the trails of sprite pCheckSpriteNum = false
  106.   mSwitchToBIY(pCurrentBIYobj)
  107.   
  108. end mClose
  109. --------------------------------------------------------------------<<ò>>
  110. on mInformJournal me, argStatus
  111.   
  112.   if argStatus = #ArrivingAtBIY then
  113.     set pAtBIY = true
  114.   else if argStatus = #LeavingBIY then
  115.     set pAtBIY = false
  116.   end if
  117.   
  118. end mInformJournal
  119. --------------------------------------------------------------------<<ò>>
  120. on mJournalClickEvent me
  121.   
  122.   --  put "mJournalClickEvent accessed"
  123.   set mousePoint = point(the mouseH, the mouseV)
  124.   
  125.   if gInventorIndexNum = 1 then
  126.     mEdisonJrnlClick(me, mousePoint)
  127.   else if gInventorIndexNum = 2 then
  128.     mWattJrnlClick(me, mousePoint)
  129.   else if gInventorIndexNum = 3 then
  130.     mBellJrnlClick(me, mousePoint)
  131.   end if
  132.   
  133.   dontpassevent
  134.   
  135. end mJournalClickEvent
  136. --------------------------------------------------------------------<<ò>>
  137. on mEdisonJrnlClick me, argMousePoint
  138.   
  139.   if inside (argMousePoint, pEdisonBox) then
  140.     set GridPoint = mRectGridCheck(me, pEdisonBox, argMousePoint, 5, 8)             --GridPoint is a list: [x, y]
  141.     set CollumClicked = getAt(GridPoint, 1)
  142.     set RowClicked = (getAt(GridPoint, 2))
  143.     set BIYrecordList = mDiscloseTestRecord(pCurrentBIYobj)
  144.     set BIYrecordIndex = (CollumClicked - 1) * 8 + RowClicked
  145.     set ClickedACheck = getAt(BIYrecordList, BIYrecordIndex)
  146.     if ClickedACheck then 
  147.       mClose(me)
  148.       mReviewExperiment(pCurrentBIYobj, RowClicked, CollumClicked)
  149.     end if
  150.   else
  151.     mClose(me)
  152.   end if
  153.   
  154. end mEdisonJrnlClick
  155. --------------------------------------------------------------------<<ò>>
  156. on mWattJrnlClick me, argMousePoint
  157.   
  158.   if inside(argMousePoint, pWattTopBox) then
  159.     set HitaBox = true
  160.     set WhichBox = pWattTopBox
  161.     set vAdjuster = 0
  162.   else if inside(argMousePoint, pWattBottomBox) then
  163.     set HitaBox = true
  164.     set WhichBox = pWattBottomBox
  165.     set vAdjuster = 3
  166.   else
  167.     set HitaBox = false
  168.     mClose(me)
  169.   end if
  170.   
  171.   if HitaBox then
  172.     
  173.     set GridPoint = mRectGridCheck(me, WhichBox, argMousePoint, 3, 3)             --GridPoint is a list: [x, y]
  174.     set CollumClicked = getAt(GridPoint, 1)
  175.     set RowClicked = (getAt(GridPoint, 2)) + vAdjuster
  176.     
  177.     mClose(me)
  178.     mReviewExperiment(pCurrentBIYobj, RowClicked, Collumclicked)
  179.   end if
  180.   
  181. end mWattJrnlClick
  182. --------------------------------------------------------------------<<ò>>
  183. on mBellJrnlClick me, argMousePoint
  184.   
  185.   if inside(argMousePoint, pBellTopBox) then
  186.     set HitaBox = true
  187.     set WhichBox = pBellTopBox
  188.     set vAdjuster = 0
  189.   else if inside(argMousePoint, pBellMiddleBox) then
  190.     set HitaBox = true
  191.     set WhichBox = pBellMiddleBox
  192.     set vAdjuster = 4
  193.   else if inside(argMousePoint, pBellBottomBox) then
  194.     set HitaBox = true
  195.     set WhichBox = pBellBottomBox
  196.     set vAdjuster = 8
  197.   else
  198.     set HitaBox = false
  199.     mClose(me)
  200.   end if
  201.   
  202.   if HitaBox then
  203.     set GridPoint = mRectGridCheck(me, WhichBox, argMousePoint, 3, 4)
  204.     set CollumClicked = getAt(GridPoint, 1)
  205.     set RowClicked = (getAt(GridPoint, 2)) + vAdjuster
  206.     set BellTestRecord = mDiscloseTestRecord(pCurrentBIYobj)
  207.     set ExperimentRecordIndex = ((CollumClicked - 1) * 12) + RowClicked
  208.     if getAt(BellTestRecord, ExperimentRecordIndex) = 1 then
  209.       mClose(me)
  210.       mReviewExperiment(pCurrentBIYobj, RowClicked, Collumclicked)
  211.     end if
  212.   end if
  213.   
  214. end mBellJrnlClick
  215. --------------------------------------------------------------------<<ò>>
  216. on mRectGridCheck me, argWhichBox, argMousePoint, argNumCollums, argNumRows
  217.   
  218.   set RectWidth = getAt(argWhichBox, 3) - getAt(argWhichBox, 1)
  219.   set RectHeight = getAt(argWhichBox, 4) - getAt(argWhichBox, 2)
  220.   set RelativeMouseX = getAt(argMousePoint, 1) - getAt(argWhichBox, 1)
  221.   set RelativeMouseY = getAt(argMousePoint, 2) - getAt(argWhichBox, 2)
  222.   set CollumClicked = RelativeMouseX / (RectWidth / argNumCollums) + 1
  223.   set RowClicked = RelativeMouseY / (RectHeight / argNumRows) + 1
  224.   return [CollumClicked, RowClicked]
  225.   
  226. end mRectGridCheck
  227. --------------------------------------------------------------------<<ò>>
  228. on mDrawEdisonChecks me                      --pEdisonLocHList pEdisonLocVList pEdisonBox
  229.   
  230.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  231.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  232.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  233.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  234.   set BIYrecordIndex = 1
  235.   put "BIYrecordIndex = " & BIYrecord
  236.   repeat with CurrentCollum = 1 to count(pEdisonLocHList)
  237.     set xCoordinate = getAt(pEdisonLocHList, CurrentCollum)
  238.     repeat with CurrentRow = 1 to count(pEdisonLocVList)
  239.       if getAt(BIYrecord, BIYrecordIndex) = true then
  240.         set yCoordinate = getAt(pEdisonLocVList, CurrentRow)
  241.         if (getPos(pEdisonLocHList, xCoordinate) = CorrectX) and (getPos(pEdisonLocVList, yCoordinate) = CorrectY) then
  242.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  243.         else
  244.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  245.         end if
  246.         set the locH of sprite pCheckSpriteNum = xCoordinate
  247.         set the locV of sprite pCheckSpriteNum = yCoordinate
  248.         updateStage
  249.       end if
  250.       set BIYrecordIndex = BIYrecordIndex + 1
  251.     end repeat
  252.   end repeat
  253.   
  254. end mDrawEdisonChecks
  255. --------------------------------------------------------------------<<ò>>
  256. on mDrawWattChecks me
  257.   
  258.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  259.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  260.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  261.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  262.   set BIYrecordIndex = 1
  263.   repeat with CurrentRow = 1 to count(pCylinderAxisLocVList)
  264.     set yCoordinate = getAt(pCylinderAxisLocVList, CurrentRow)
  265.     repeat with CurrentCollum = 1 to count(pCondensorAxisLocHList)
  266.       if getAt(BIYrecord, BIYrecordIndex) = true then
  267.         set xCoordinate = getAt(pCondensorAxisLocHList, CurrentCollum)
  268.         if (getPos(pCondensorAxisLocHList, xCoordinate) = CorrectX) and (getPos(pCylinderAxisLocVList, yCoordinate) = CorrectY) then
  269.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  270.         else
  271.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  272.         end if
  273.         set the locH of sprite pCheckSpriteNum = xCoordinate
  274.         set the locV of sprite pCheckSpriteNum = yCoordinate
  275.         updateStage
  276.       end if
  277.       set BIYrecordIndex = BIYrecordIndex + 1
  278.     end repeat
  279.   end repeat
  280.   
  281. end mDrawWattChecks
  282. --------------------------------------------------------------------<<ò>>
  283. on mDrawBellChecks me
  284.   
  285.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  286.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  287.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  288.   set CorrectZ = mDiscloseCorrectZ(pCurrentBIYobj)
  289.   set AdjustedCorrectY = (CorrectZ - 1) * 4 + CorrectY
  290.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  291.   
  292.   set yCounter = 1
  293.   repeat with yCoordinate in pBellLocVList
  294.     set xCounter = 1
  295.     repeat with xCoordinate in pBellLocHList
  296.       set RecordIndex = (xCounter - 1) * 12 + yCounter
  297.       if (xCoordinate = CorrectX) and (yCoordinate = AdjustedCorrectY) then
  298.         set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  299.       else
  300.         set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  301.       end if
  302.       if getAt(BIYrecord, RecordIndex) =1 then
  303.         set the locH of sprite pCheckSpriteNum = xCoordinate
  304.         set the locV of sprite pCheckSpriteNum = yCoordinate
  305.         updateStage
  306.       end if
  307.       set xCounter = xCounter + 1
  308.     end repeat
  309.     set yCounter = yCounter + 1
  310.   end repeat
  311.   set the locH of sprite pCheckSpriteNum = -500
  312.   
  313. end mDrawBellChecks
  314. --------------------------------------------------------------------<<ò>>
  315. --------------------------------------------------------------------<<ò>>